familypediawikiaorg-20200214-history
Help:Section
A page can be divided into sections, using the section header syntax. Creation and numbering of sections Sections are created by creating their headers, as below: Section Subsection Sub-subsection Please do not use only one equals sign on a side (=text here=); this causes a title the size of the page name, which is taken care of automatically. With the preference setting sections are numbered. Table of contents (TOC) For each page with more than three headings, a table of contents (TOC) is automatically generated from the section headings, unless: * (for a user) are set to turn it off *(for an article) the (with two underscores on either side of the word) is added in the edit box When either __FORCETOC__ or __TOC__ (with two underscores on either side of the word) is placed in the wikitext, a TOC is added even if the page has fewer than four headings. With __FORCETOC__ the TOC is put before the first section header. With __TOC__, it is put at the position of this code. This allows any positioning, also e.g. on the right, and in a table cell, and it also allows multiple occurrence, e.g. in every section (demonstrated on m:Help talk:Section; however, this seems only useful if the sections are long, so that the TOCs take up only a small part of the total space.). Thus there may be some introductory text before the TOC, known as the "lead". Although usually a header after the TOC is preferable, __TOC__ can be used to avoid being forced to insert a meaningless header just to position the TOC correctly, i.e., not too low. Preferences can be set to number the sections automatically. In a page calling a with sections, the sections in the template are numbered according to their position in the rendered page, e.g. if the template tag is in the third section, then the first section of the template is numbered four. Any text in the template before its first section shows up as part of the section with the template tag, and any text after the tag before a new header shows up as part of the last section of the template. This may be done deliberately, but can usually better be avoided (see also below). Using it's possible to disable the normal Table of Contents. Section links as explained below allow to create compact ToCs, e.g. alphabetical A B etc. The Table of contents can be forced onto a floating table on the right hand of the screen with the code below Section linking In the HTML code for each section there is an anchor element with both "name" and "id" attributes holding the section title. This enables linking directly to sections. These section anchors are automatically used by MediaWiki when it generates a Table of Contents for the page, but you can also use them to manually link directly to one section within a page. The HTML code generated at the beginning of this section, for example, is: Section linking A link to this section ( ) looks like this: To link to a section in the same page you can use link_label, and to link to a section in another page link_label. To create an anchor target without a section header, you can use a span, for example: , however this won't work with some very old browsers. An underscore and number are appended to duplicate section names. E.g. for three sections named "Example", the names (for section linking) will be "Example", "Example_2" and "Example_3". Note that using the in section headers complicates section linking. An internal link in a section header does not give complications: *Demo_a * *http://meta.wikimedia.org/wiki/Help:Section#Demo_http:.2F.2Fa For linking to an arbitrary position in a page see . Section linking and redirects A link that specifies a section of a redirect page corresponds to a link to that section of the target of the redirect. A to a section of a page goes to the top of the page. One can use it anyway as a clarification, and at least it works when clicking on the link from the redirect page. A complication is that, unlike renaming a page, renaming a section does not create some kind of redirect. Also there is no separate feature for sections, pages linking to the section are included in the list of pages linking to the page. Possible workarounds: *put an anchor and link to that *put a comment in the wikitext at the start of a section listing pages that link to the section *make the section a separate page/template and either transclude it into, or just link to it from, its parent page; instead of linking to the section one can then link to the separate page. Section links You can use section linking to link to a section within the same page (using displayed text, and if another section with the same name exists a _ (sequential number) is appended as in displayed text), or to a section within another page (using displayed text). For example to link the table of contents entry: test Type: test where you want the user to jump to. When a user presses "test" in the table of contents, they will automatically jump to the test entry below in the text. If a (sub)section has a blank space as header, it results in a link in the TOC that does not work. For a similar effect see . Section editing Sections can be separately edited ("section editing feature") by right clicking on the section header and/or special edit links, depending on the preferences set, and by a url like http://meta.wikimedia.org/w/wiki.phtml?title=Help:Section&action=edit&section=2 (Note that here section numbers are used, not section titles; subsections have a single number, e.g. section 2.1 may be numbered 3, section 3 is then numbered 4, etc.) This is convenient if the edit does not involve other sections and one needs not have the text of other sections at hand during the edit (or if one needs it, open the section edit link in a new window, or during section editing, open "Cancel" in a window). Section editing alleviates some problems of large pages. "__NOEDITSECTION__" anywhere on the page will remove the edit links. It will not disable section editing itself; right clicking on the section header and the url still work. Inserting a section can be done by editing either the section before or after it, merging with the previous section by deleting the header. Adding a section at the end can also be done with a URL like http://meta.wikimedia.org/w/wiki.phtml?title=Meta:Sandbox&action=edit&section=new . On talk pages a link is provided for this. The section header is the same as the , and typed only once. There is much more on that Wikipedia page, which is updated from the original on "Meta-Wiki": m:Help:Section. Category:Help